package oocis.oocisSharing;

import java.io.IOException;

import oocis.util.*;

public class SourceUploading extends SourceOperating {
	
	Server server;
	String localDir;
	String filename;
	String message;

	public SourceUploading(Server _server, String _localDir, String _filename, String _message){
		server = _server;
		localDir = _localDir;
		filename = _filename;
		message = _message;
	}
	
	public int operate() {
			try {
				if (SVNClient.add(localDir, filename) != 0)
					return 1;
				if ((SVNClient.commit(server.getAddress(), localDir + filename, message)) != 0)
					return 1;
				return 0;
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return -1;
			}
	}

}
